# 递归的思路 左右根 后序遍历，每次返回以当前节点为根节点的子树的深度
class Solution:
    def maxDepth(self , root ):
        # write code here
        if not root:
            return 0
        return max(self.maxDepth(root.left),self.maxDepth(root.right))+1
# 后续2
class Solution:
    def maxDepth(self , root ):
        # write code here
        return self.postOrder(root)
    def postOrder(self, root):
        if not root:
            return 0
        left = 1 + self.postOrder(root.left)
        right = 1 + self.postOrder(root.right)
        return max(left,right)